﻿@using System.Data
@using PicStore.Model
@model PicStore.Web.Models.Report.ReportModel

@{
    ViewBag.Title = "Report";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

@using (Html.BeginForm("GetReport", "Report", FormMethod.Post, new { id = "GetReportForm", @class = "form-horizontal" }))
{
    <div class="control-group">
        @Html.LabelFor(model => model.CategoryId, new { @class = "control-label" })
        <div class="controls">
            @Html.DropDownListFor(m => m.CategoryId, Model.CategoryList)
        </div>
    </div>
    <div class="control-group">
        @Html.LabelFor(model => model.Month, new { @class = "control-label" })
        <div class="controls">
            @Html.DropDownListFor(m => m.Month, Model.MonthList)
            <input type="submit" class="btn btn-primary" value="ViewReport" />
        </div>
    </div>
    
    <table  class="table table-striped table-bordered table-condensed">
        <tr>
            <td>CategoryItemName</td>
            <td>Year</td>
            <td>Percent Value</td>
            <td>Category Count</td>
        </tr>
        @{
            var table = Model.ReportTable;
            foreach (var reportItem in table)
            {
                <tr>
                    <td>@reportItem.CategoryItemName</td>
                    <td>@reportItem.Year</td>
                    <td>@reportItem.PercentValue</td>
                    <td>@reportItem.CategoryCount</td>
                </tr>
            }
        }
    </table>
    foreach (var image in Model.ReportImageNames)
    {
        <img src="@image" />
    }
}
